home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung CD 2 (Tewi)(1994).iso
/
c
/
compiler
/
small_c
/
byte_sc
/
utoi.c
< prev
next >
Wrap
Text File
|
1987-10-04
|
384b
|
16 lines
#include stdio.h
/*
** utoi -- convert unsigned decimal string to integer nbr
** returns field size, else ERR on error
*/
utoi(decstr, nbr) char *decstr; int *nbr; {
int d,t; d=0;
*nbr=0;
while((*decstr>='0')&(*decstr<='9')) {
t=*nbr;t=(10*t) + (*decstr++ - '0');
if ((t>=0)&(*nbr<0)) return ERR;
d++; *nbr=t;
}
return d;
}